package structure;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author antonio
 */

import java.util.*;
import java.io.*;

public class HashSpatialStructureHandler {

    private Hashtable hashSpatialStructure;
    private String dir;

    public HashSpatialStructureHandler(Hashtable hashSpatialStructure, String dir)
    {
        this.hashSpatialStructure = hashSpatialStructure;
        this.dir = dir;
        this.initializeHash();
    }


    public void initializeHash()
    {
        File f = new File(this.dir);

        if(f.isDirectory())
        {
            String[] file = f.list();
            for(int i=0; i<file.length; i++)
            {
                this.hashSpatialStructure.put(file[i], 0);     //key=stanza   value=hash dei segnali della stanza
            }

        }
        else
        {

        }
    }


    public void updateSpatialStructure(String key, Hashtable hashProbability)
    {
        
            this.hashSpatialStructure.remove(key);
            this.hashSpatialStructure.put(key, hashProbability);
        
    }


}
